#include <sys/eventfd.h>
#include <iostream>

int main()
{
    int _eventfd = eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK);
    if (_eventfd == -1)
    {
        perror("eventfd");
        exit(EXIT_FAILURE);
    }
    uint64_t data = 1;
    eventfd_write(_eventfd, data);
    eventfd_write(_eventfd, data);
    eventfd_write(_eventfd, data);

    uint64_t msg;
    eventfd_read(_eventfd, &msg);
    std::cout << "msg: " << msg << std::endl;
    return 0;
}